<?php
header("Content-type:text/html;charset=utf-8");
require_once './src/PHPMailer.php';
set_time_limit(60);

$mailserver = $_POST['mailserver'];
$port    = $_POST['port'];
$mailuser = $_POST['mailuser'];
$mailpass = $_POST['mailpass'];
$mailto = $_POST['mailto'];
$subject = $_POST['subject'];     // 邮件标题
$body    = $_POST['content'];     // 邮件正文
//构建邮件
$mail=array(
    "subject"=>$subject,
    "body"=>array(
        'content'=>$body,
    )
);
// print_r("<pre/>");
$test=new SendMaill($mailserver, $port, $mailuser, $mailpass, false, false);
if($test->sendMail($mailto, $mail, true)){
    echo json_encode(array('status' => 'success', 'message' => '邮件发送成功'), true);
    die();
}else {
    echo json_encode(array('status' => 'error', 'message' => '邮件发送成功'), true);
    die();
}
?>